package com.keste.adf.ui.bean.common;

import com.keste.adf.ui.fwk.util.ADFUtils;

import oracle.binding.OperationBinding;

import oracle.jbo.domain.Number;

public class QuestionHelperBean {
    public QuestionHelperBean() {
    }

//    public Boolean IsQuestionSubmittable(Number examId, Number questionId) {
//        OperationBinding isSubmittableMethod = ADFUtils.findOperationBinding("canUserSubmitThisQuestion");
//        if (isSubmittableMethod != null) {
//            isSubmittableMethod.getParamsMap().put("examId", examId);
//            isSubmittableMethod.getParamsMap().put("questionId", questionId);
//            isSubmittableMethod.execute();
//            
//            Boolean isSubmittable = (Boolean)isSubmittableMethod.getResult();
//            
//            return isSubmittable;
//        }
//        
//        return false;
//    }

    public Boolean IsQuestionSubmittable(Number examId, Number questionId) {
                OperationBinding isSubmittableMethod = ADFUtils.findOperationBinding("canUserSubmitThisQuestion");
                if (isSubmittableMethod != null) {
                    isSubmittableMethod.getParamsMap().put("examId", examId);
                    isSubmittableMethod.getParamsMap().put("questionId", questionId);
                    isSubmittableMethod.execute();
                    
                    Boolean isSubmittable = (Boolean)isSubmittableMethod.getResult();
                    
                    return isSubmittable;
                }
                
                return false;
    }
}
